/**
 * RemoteFileServer.java
 */
package fss.remote.util;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.List;
import java.util.Map;

import fss.common.communication.QueryResult;
import fss.common.communication.Request;
import fss.remote.RemoteClient;
import fss.transfer.Transfer;
import fss.transfer.TransferId;

public interface RemoteFileService extends Remote {
    /**
     * Get a list of file(s) from the file server.
     * 
     * @return a list of files, or an empty list.
     * @throws RemoteException error invoking method.
     */
    public List<QueryResult> getFileList() throws RemoteException;
    /**
     * Get a list of file(s) on the remote file service that matches the 
     * specified parameter.
     * 
     * @param param the parameter.
     * @return a list of file names or an empty list (for no match).
     * @throws RemoteException error invoking method.
     */
    public List<QueryResult> query(String param) throws RemoteException;
    /**
     * Obtain a map of all the current File Service transfers that are currently 
     * and has occurred on the Remote File Service.
     * 
     * @return a set of all the transfer activities on the file service.
     * @throws RemoteException error invoking method.
     */
    public Map<TransferId, Transfer> getStatus() throws RemoteException;
    /**
     * Process a request.
     * <p>
     * When a request comes, the registry will try to notify its observer(s) that a
     * request came. Only the observers/subscribes will process the request.
     * @param request the request object.
     * @throws RemoteException remote invocation error.
     */
    public void processRequest(Request request) throws RemoteException;
    /**
     * Get the number of active downloads.
     * @return the download count.
     * @throws RemoteException remote invocation error.
     */
    public int getDownloadCount() throws RemoteException;
    /**
     * Get the number of active uploads.
     * @return the upload count.
     * @throws RemoteException remote invocation error.
     */
    public int getUploadCount() throws RemoteException;
    /**
     * Register a remote client.
     * <p>
     * This is similar to <code>Obserable.addObserver</code> method.
     * @param service the remote service.
     * @throws RemoteException remote invocation error.
     */
    public void register(RemoteClient client) throws RemoteException;
    /**
     * Get the file service list of incomplete transfer(s).
     * @return a list of incomplete transfer(s).
     * @throws RemoteException remote invocation error.
     */
    public List<Transfer> getIncompleteTransferList() throws RemoteException;
    /**
     * Resume a single transfer (upload).
     * @param transferId the transfer identifier.
     * @throws RemoteException remote invocation error.
     */
    public void resume(TransferId transferId) throws RemoteException;
}
